<template>
  <div class="d-tooltip-box ant-tooltip tooltip-placement-top" v-show="visible" :style="anchorStyle">
    <div class="ant-tooltip-content">
      <div class="ant-tooltip-arrow"><span class="ant-tooltip-arrow-content"></span></div>
      <div class="ant-tooltip-inner" role="tooltip">{{ content }}</div>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue';
export default defineComponent({
  name: 'd-tooltip-box',
  props: {
    content: {
      type: String,
      default: ''
    },
    position: {
      type: Array,
      default() {
        return [0, 0];
      }
    },
    visible: {
      type: Boolean,
      default: false
    }
  },
  computed: {
    anchorStyle() {
      const [left, bottom] = this.position;
      return `left: ${left - 10}px;bottom: ${bottom + 10}px`;
    }
  },
  methods: {}
});
</script>

<style lang="less">
.d-tooltip-box {
  .ant-tooltip-arrow {
    left: 5px;
    top: 100%;
    .ant-tooltip-arrow-content {
      box-shadow: 3px 3px 7px rgb(0 0 0 / 7%);
      transform: translateY(-6.53553391px) rotate(45deg);
    }
  }
}
</style>
